package com.example;

import com.bstek.ureport.console.UReportServlet;
import com.example.ext.jwt.JwtFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;

//@ImportResource("classpath:context.xml")
@EnableTransactionManagement
@SpringBootApplication
@EnableDiscoveryClient
public class ElevatorApplication {

    public static void main(String[] args) {
        SpringApplication.run(ElevatorApplication.class, args);
    }

    //gateway 那边进行token校验
//    @Bean
//    public FilterRegistrationBean jwtFilter(){
//        final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
//        registrationBean.setFilter(new JwtFilter());
//        //registrationBean.addUrlPatterns("/app/*");
//        registrationBean.addUrlPatterns("/api/*");
//        return registrationBean;
//    }

    /**
     * 测试服务器不支持 内存太小，暂时注释
     */
//    @Bean
//    public ServletRegistrationBean buildUreportServlet() {
//        return new ServletRegistrationBean(new UReportServlet(), "/ureport/*");
//    }
}
